<template>
	<view class="page">
		<!-- 搜索 -->
		<view class="search-block">
			<view class="search-ico-wapper">
				<image src="../../static/icons/search.png" class="search-ico"></image>
			</view>
			<input placeholder="搜索预告片" maxlength="10" class="search-text" confirm-type="search" @confirm="searchMe" />
		</view>
		<!-- 预告片 -->
		<view class="movie-list page-block">
			<view class="movie-wapper" v-for="item in trailerMovieList" :key="item.id">
				<image :src="item.cover" class="posinter" :data-trailerId="item.id" @click="toMovieDetail"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				trailerMovieList: [{
						id: 1,
						cover: 'https://t12.baidu.com/it/u=2958578885,621812954&fm=58&app=83&f=JPEG?w=200&h=266'
					},
					{
						id: 2,
						cover: 'https://t12.baidu.com/it/u=2958578885,621812954&fm=58&app=83&f=JPEG?w=200&h=266'
					},
					{
						id: 3,
						cover: 'https://t10.baidu.com/it/u=1924559799,992097550&fm=58&app=83&f=JPEG?w=200&h=266'
					},
					{
						id: 4,
						cover: 'https://t10.baidu.com/it/u=1924559799,992097550&fm=58&app=83&f=JPEG?w=200&h=266'
					},
					{
						id: 5,
						cover: 'https://t12.baidu.com/it/u=2958578885,621812954&fm=58&app=83&f=JPEG?w=200&h=266'
					},
					{
						id: 6,
						cover: 'https://t10.baidu.com/it/u=1924559799,992097550&fm=58&app=83&f=JPEG?w=200&h=266'
					},
					{
						id: 7,
						cover: 'https://t12.baidu.com/it/u=2958578885,621812954&fm=58&app=83&f=JPEG?w=200&h=266'
					},
					{
						id: 8,
						cover: 'https://t12.baidu.com/it/u=3340323604,832134220&fm=58&app=83&f=JPEG?w=200&h=266'
					},
					{
						id: 9,
						cover: 'https://t12.baidu.com/it/u=2958578885,621812954&fm=58&app=83&f=JPEG?w=200&h=266'
					},
					{
						id: 10,
						cover: 'https://t12.baidu.com/it/u=3340323604,832134220&fm=58&app=83&f=JPEG?w=200&h=266'
					},
					{
						id: 11,
						cover: 'https://t12.baidu.com/it/u=2958578885,621812954&fm=58&app=83&f=JPEG?w=200&h=266'
					},
					{
						id: 12,
						cover: 'https://t12.baidu.com/it/u=3340323604,832134220&fm=58&app=83&f=JPEG?w=200&h=266'
					},
				],
				keywords: '',
				page: 1,
				totalPages: 1
			}
		},
		onLoad() {},
		onReachBottom() {},
		methods: {
			searchMe(e) {
				let value = e.detail.value
				this.keywords = value
				this.trailerMovieList = []
			},
			// 去详情页面
			toMovieDetail(e) {
				let trailerId = e.currentTarget.dataset.trailerid
				uni.navigateTo({
					url: "../moviedetail/moviedetail?trailerId=" + trailerId
				})
			}
		}
	}
</script>

<style>
	@import url("./search.scss");
</style>
